/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include <向量.h>
#include <物理/物理.h>
#include <物体/物体.h>

#include "节点/节点.h"


typedef struct {
	E_值类型	type;
	S_物体*		m_车辆物体;
	//S_车轮参数	m_车轮参数;
	S_物理体*	m_车轮物理体;
}S_车轮插座属性;


typedef struct {
	E_值类型				type;

	S_车体参数				m_车体参数;

	uint32					m_物体ID;

	S_三角Mesh				m_车体网格;
}S_车体属性;













typedef struct {
	S_物理体*	m_PhyObj;
	S_物体*		m_UseObj;
}S_物理体插座数据;



/*class PxGeometry;
typedef struct {
	PxGeometry* gem;
}S_物理几何体插座数据;*/


typedef struct {
	S_物理几何体*		m_Data;
	E_物理碰撞几何类型	m_Type;
}S_物理几何体插座数据;









S_Props f_创建物理引擎类型属性数据();
S_Props f_创建物理几何类型属性数据();







class C_物理解算器插座 : public C_插座基类 {
	E_物理引擎 E_物理引擎type;
	S_Physics* m_Physics;
public:
	C_物理解算器插座(std::wstring name);

	//S_物理材质* m_Value;
	void*	f_getData(uint8 线程ID);
	void	f_setData(void* data, uint8 线程ID = 0);

	std::wstring		f_getTypeName() { return L"phy"; }
};
#define DEF_物理解算器插座(socket) dynamic_cast<C_物理解算器插座*>( (socket) )
#define DEF_物理引擎插座数据(socket)  ((S_Physics*)((socket)->f_getData(0)))

#define DEF_创建物理引擎插座_I(name) socket = new C_物理解算器插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建物理引擎插座_O(name) socket = new C_物理解算器插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);








class C_物理材质插座 : public C_插座基类 {
	S_物理材质* m_默认数据;

public:
	C_物理材质插座(std::wstring name);

	S_物理材质* m_Value;

	void*	f_getData(uint8 线程ID);
	void	f_setData(void* data, uint8 线程ID = 0);

	std::wstring		f_getTypeName() { return L"phyMat"; }
};
#define DEF_物理材质插座(socket) dynamic_cast<C_物理材质插座*>( (socket) )
#define DEF_物理材质插座Value(socket, tid)  ((S_物理材质*)socket->f_getData(tid))

#define DEF_创建物理材质插座_I(name) socket = new C_物理材质插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建物理材质插座_O(name) socket = new C_物理材质插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);










class C_物理几何插座 : public C_插座基类 {
	E_物理碰撞几何类型		m_默认碰撞类型;
	E_物理引擎				m_物理引擎;

	S_物理几何体插座数据	m_默认数据;
public:
	C_物理几何插座(std::wstring name);

	S_物理几何体插座数据	m_Value;

	void*	f_getData(uint8 ID);
	void	f_setData(void* data, int64 ID = -1);

	std::wstring		f_getTypeName() { return L"phyGen"; }
};
#define DEF_物理几何插座(socket) dynamic_cast<C_物理几何插座*>( (socket) )
#define DEF_物理几何插座Value(socket)  (*((S_物理几何体插座数据*) ((socket)->f_getData()) ))

#define DEF_创建物理几何插座_I(name) socket = new C_物理几何插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建物理几何插座_O(name) socket = new C_物理几何插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);


//S_物理几何体* f_从网格创建物理几何碰撞对象(S_物理解算器* phy, S_网格插座数据& mesh, E_物理碰撞几何类型 type, E_物理引擎 e);






class C_骨骼IK插座 : public C_插座基类 {
public:
	C_骨骼IK插座(std::string name);

	void* m_Value;

	void*			f_getData(uint8 ID);
	void			f_setData(void* data, int64 ID = -1);
	std::wstring	f_getTypeName() { return L"IK"; }
};
#define DEF_转换物理体插座(socket) dynamic_cast<C_物理体插座*>( (socket) )
#define DEF_物理体Value(socket)  *((U_物理几何体插座数据*)socket->f_getData())





/*

class C_物理体插座 : public C_插座基类 {
public:
	C_物理体插座(std::string name);

	void*	m_Value;

	void*		f_getData();
	void		f_setData(void* data, int64 ID = -1);

};
#define DEF_转换物理体插座(socket) dynamic_cast<C_物理体插座*>( (socket) )
#define DEF_物理体Value(socket)  *((U_物理几何体插座数据*)socket->f_getData())















class C_车轮属性插座 : public C_插座基类 {
public:
	C_车轮属性插座(std::string name);
	~C_车轮属性插座();
	//S_Px车轮		m_Value;
	//S_车轮插座属性	m_Value;
	S_车轮参数		m_Value;
	
	void*		f_getData();
	void		f_setData(void* data, int64 ID = -1);

	PyObject*	f_输出_bl数据(PyObject* bl_data = 0);

};
#define DEF_转换为车轮属性插座(socket) dynamic_cast<C_车轮属性插座*>( (socket) )
#define DEF_车轮属性插座Value(socket)  ((S_车轮参数*)( (socket)->f_getData() ) )

#define DEF_创建车轮插座_I(name)  socket = new C_车轮属性插座( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输入);
#define DEF_创建车轮插座_O(name)  socket = new C_车轮属性插座( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输出);










class C_车辆属性插座 : public C_插座基类 {
public:
	C_车辆属性插座(std::string name);
	~C_车辆属性插座();

	S_车体属性	m_车体属性;

	void*		f_getData();
	void		f_setData(void* data, int64 ID = -1);

};
#define DEF_转换为车辆属性插座(socket) dynamic_cast<C_车辆属性插座*>( (socket) )
#define DEF_车辆属性插座Value(socket)  *((S_车体属性*)socket->f_getData())

*/

